package com.learning.neo4j.baseapi.spring;

import com.learning.neo4j.baseapi.Movie;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

/**
 * ClassName: MovieRespon
 * Description:
 * Date: 2019/3/28 17:57 【需求编号】
 *
 * @author Sam Sho
 * @version V1.0.0
 */
public interface MovieRepository extends Neo4jRepository<Movie, Long> {

    /**
     * 获取时间范围内的电影
     *
     * @param start
     * @param end
     * @return
     */
    @Query("match (nineties:Movie) where nineties.released > {start} and nineties.released < {end} return nineties")
    List<Movie> getBetweenYearMovies(@Param("start") int start, @Param("end") int end);

}
